#ifndef _STRAWGUI_ACTION_HANDLER_EDIT_TEXT_H_
#define _STRAWGUI_ACTION_HANDLER_EDIT_TEXT_H_

#include "sActionHandler.h"
#include "sDrawStack.h"
#include "sCRIEditableText.h"
#include "sCIEdit.h"

namespace sgui
{
namespace inst
{

struct sActionHandlerEditTextEvent : public sActionHandlerEvent
{
    EActionEventID getID() const { return EAEID_EDIT_TEXT; }
};

class sActionHandlerEditText: public sActionHandler
{
private:
	double							m_timer;
	sComponentInstanceEdit*			m_edit;
	sComponentRectEditableText*		m_editText;
	sTextCursorPosition				m_cursorPosition;
    math::sPointf                   m_cursorPos;
    f32                             m_cursorHeight;
public:

	static const float	BLINK_TIME;

    bool isEventsLocked() { return true; }
    bool isUpdateLocked() { return false; }
	
	bool update(double dt);
	void draw(engine::sDrawStack& stack) const;
    bool OnEvent(const obs::sEvent& event);

    sActionHandlerEditText(sComponentInstance* instance, sComponentRectInstance *caller);
    ~sActionHandlerEditText();
};

};
};

#endif